﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShoppingCart.aspx.cs" Inherits="PetShop.ShoppingCart" StylesheetTheme="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Shopping Cart</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="margin-bottom:10px">
        <span style="margin-right:30px">欢迎: <asp:LoginName ID="LoginName1" runat="server" /></span>
        <span><asp:LoginStatus ID="LoginStatus1" LoginText="登录" LogoutText="注销" runat="server" /></span></div>
    <div>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" /> 
    </div>
    <div>
        <asp:GridView runat="server" ID ="GridViewOrder" AutoGenerateColumns ="False" 
            Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None" 
            onrowcommand="GridViewOrder_RowCommand">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:TemplateField HeaderText = "ID">
                <ItemTemplate>
                    <asp:Label runat="server" ID="LabelProductID" Text='<%#Eval("ProductID")%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText = "名称" DataField="ProductName" />
            <asp:TemplateField HeaderText = "数量">
                <ItemTemplate>
                    <asp:TextBox runat="server" ID="TextBoxQuantity" Text='<%#Eval("Quantity")%>' ></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorQuantity" runat="server" ControlToValidate="TextBoxQuantity" ErrorMessage="The quantity is mandatory." Display="None"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidatorQuantity" runat="server" ControlToValidate="TextBoxQuantity" ErrorMessage="The quantity must be a valid integer which is greater than zero." Display="None" Type="Integer" ValueToCompare="0" Operator="GreaterThan"></asp:CompareValidator></ItemTemplate>
            </asp:TemplateField>
            <asp:ButtonField CommandName = "UpdateQuantity" Text = "更新"  CausesValidation="true"/>
            <asp:ButtonField CommandName = "DeleteProduct" Text = "移除" CausesValidation ="false" />
        </Columns>                   
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
    </asp:GridView>
    </div>
    <div id = "footer" >
        <span id="left">
            总价:<asp:Label style="color:Red" runat="server" ID="LabelTotalPrice" />&nbsp; 数量: <asp:Label style="color:Red" runat="server" ID="LabelQuantity" />
        </span>
         <span id="center">
            <asp:LinkButton runat="server" ID="LinkButtonCheckout" Text="结帐" 
            onclick="LinkButtonCheckout_Click" />
        </span>
        <span id="right">
            <a href="Default.aspx">继续选择</a>
        </span>
    </div>
    </form>
</body>
</html>
